import unittest

from api.ihrm_employ_api import IhrmEmployApi

from common.assert_util import aassert_util
# from common.db_util import DBUtil
from common.get_header import get_header
from common.molile import TEL


class TestIhrmApi(unittest.TestCase):
    header = None
    @classmethod
    def setUpClass(cls) -> None:
        cls.header = get_header

    # def setUp(self) -> None:
    #     delete_sql =  f"delete from bs_uesr where mobile= {TEL}"
    #     DBUtil.uid_db(delete_sql)
    #
    # def tearDown(self) -> None:
    #     delete_sql = f"delete from bs_uesr where mobile= {TEL}"
    #     DBUtil.uid_db(delete_sql)


    def test01_add_rmp(self):
        # header = {"Content-Type": "application/json", "Authorization": "Bearer 04030d72-8ffb-4d98-882b-012c265a8cd8"}
        json_data = {
            "username": "业猪021",
            "mobile": TEL,
            "workNumber": "9547"
        }
        resp = IhrmEmployApi.add_emp(self.header, json_data)
        print("添加",  resp.json())

        aassert_util(self,resp,200,True, 10000, "操作成功")

    def test02_add_rmp(self):
        # header = {"Content-Type": "application/json", "Authorization": "Bearer 04030d72-8ffb-4d98-882b-012c265a8cd8"}
        json_data = {
            "username":"小i佩奇",
            "mobile":TEL,
            "workNumber":"9729",
            "formOfEmployment":"1"
        }
        resp = IhrmEmployApi.add_emp(self.header, json_data)
        print("添加-组合",  resp.json())

        aassert_util(self,resp,200,True, 10000, "操作成功")

